package com.hjk.waibao.mj.util;

import cn.hutool.core.util.ReUtil;

import java.util.regex.Pattern;

/**
 * @Description
 * @Author hjk
 * @Date 2020/4/25
 **/
public class ReviewIdUtil {

    public static Pattern reviewIdPattern = Pattern.compile("customer-reviews/([a-zA-Z0-9]+)");

    public static String getReviewId(String keyword) {
        if (ReUtil.isMatch("[a-zA-Z0-9]+", keyword)) {
            return keyword;
        } else {
            return ReUtil.getGroup1(reviewIdPattern, keyword);
        }

    }
}
